package com.shawn.spring.boot.yaml;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author shawn
 * @since 2020/7/18
 */
@SpringBootApplication
public class YamlApplication implements ApplicationRunner {

  @Autowired private DataSource dataSource;
  @Autowired private DataSourceConfig config;

  @Value("${isOpen}")
  private String isOpen;

  public static void main(String[] args) {
    SpringApplication.run(YamlApplication.class, args);
  }

  @Override
  public void run(ApplicationArguments args) throws Exception {
    System.out.println(dataSource.toString());
    System.out.println(config.toString());
    System.out.println(isOpen);
  }
}
